Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump default Pytest to 4.6 and add warning for future change to Pytest 5 #8648

Merged
merged 6 commits into from
Nov 21, 2019

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Nov 18, 2019

Problem

We're using an old version of Pytest from 2018 and are two major releases behind. This means users are missing out on new features like Pytest 5.0 enabling faulthandler by default and that certain plugins won't work because Pytest is too outdated.

However, Pytest 5.0 drops support for running tests with Python 2.

Solution

Set the default Pytest to 4.6.x, which is the last minor series to support Python 2. This brings nice benefits to users without being majorly breaking.

Then, we add a deprecation for users not specifying --pytest-version to ensure that they don't get bit by us switching to Pytest 5 in two major releases.

Finally, we set our own internal Pytest to the newest release so that we get the newest and greatest, e.g. default faulthandler.

Result

Users who have not specified --pytest-version will get this warning:

[WARN] /Users/eric/DocsLocal/code/projects/pants/src/python/pants/backend/python/tasks/pytest_prep.py:92: DeprecationWarning: DEPRECATED: Pants defaulting to a Python 2-compatible Pytest version will be removed in version 1.25.0.dev2.
Pants will soon start defaulting to Pytest 5.x, which no longer supports running tests with Python 2. In preparation for this change, you should explicitly set what version of Pytest to use in your pants.ini under the section pytest.

If you need to keep running tests with Python 2, set version to pytest>=4.6.6,<4.7 (the current default). If you don't have any tests with Python 2 and want the newest Pytest, set version to pytest>=5.2.4.

@Eric-Arellano Eric-Arellano force-pushed the bump-pytest branch 3 times, most recently from 28e5ad7 to 37696b9 Compare November 19, 2019 04:10
@Eric-Arellano Eric-Arellano force-pushed the bump-pytest branch 2 times, most recently from ed4eee1 to 66d22be Compare November 20, 2019 00:06
@Eric-Arellano Eric-Arellano changed the title WIP: Bump default Pytest and Pytest plugins versions to newest releases Bump default Pytest to a newer version and add warning for future change to Pytest 5 Nov 20, 2019
@Eric-Arellano Eric-Arellano marked this pull request as ready for review November 20, 2019 00:14
@Eric-Arellano Eric-Arellano changed the title Bump default Pytest to a newer version and add warning for future change to Pytest 5 Bump default Pytest to 4.6 and add warning for future change to Pytest 5 Nov 20, 2019
Copy link
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huzzah!

@Eric-Arellano
Copy link
Contributor Author

Ugh, this still strikes:

zipimport.ZipImportError: bad local file header: '/tmp/tmpznq0lc1e_BUILD_ROOT/.pants.d/python-setup/resolved_requirements/CPython-2.7.12/scandir-1.10.0-cp27-cp27mu-linux_x86_64.whl'�

Looks like we do need #8621. @jsirois does merging #8621 still sound like the right approach?

@jsirois
Copy link
Contributor

jsirois commented Nov 20, 2019

@jsirois does merging #8621 still sound like the right approach?

Absolutely.

@Eric-Arellano Eric-Arellano merged commit 092a49a into pantsbuild:master Nov 21, 2019
@Eric-Arellano Eric-Arellano deleted the bump-pytest branch November 21, 2019 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants